
#include "FileAction.h"

CFileAction::CFileAction()
{
    m_dwOption = CFileAction::None;
}

CFileAction::~CFileAction()
{

}

void CFileAction::SetAttribute(LPCTSTR strKey, LPCTSTR strValue)
{
    if (0 == _wcsicmp(strKey, L"option"))
    {
        if (0 == _wcsicmp(strKey, L"delete"))
        {
            m_dwOption = CFileAction::Delete;
        }
        else if (0 == _wcsicmp(strKey, L"copy"))
        {
            m_dwOption = CFileAction::Copy;
        }
        else if (0 == _wcsicmp(strKey, L"move"))
        {
            m_dwOption = CFileAction::Move;
        }
        else if (0 == _wcsicmp(strKey, L"create"))
        {
            m_dwOption = CFileAction::Create;
        }
    }
    else if (0 == _wcsicmp(strKey, L"path"))
    {
        m_strPath = strValue;
    }
    else if (0 == _wcsicmp(strKey, L"target"))
    {
        m_strTarget = strValue;
    }
    else
    {
        return __super::SetAttribute(strKey, strValue);
    }
}

void CFileAction::SetParent(CAction* pParent)
{

}

bool CFileAction::doit()
{
    DWORD dwFlag = ::GetFileAttributesW(m_strPath.c_str());
    switch (m_dwOption)
    {
    case Delete:
    {
        
    }break;
    case Move:
    {

    }break;
    case Copy:
    {

    }break;
    case Create:
    {

    }break;
    }


    return true;
}